import { describe, expect, it } from "vitest";

import { Template } from "../src/index";
import { tokenize } from "../src/lexer";
import { parse } from "../src/parser";
import { Environment, Interpreter, setupGlobals } from "../src/runtime";

const TEST_STRINGS = {
	// Text nodes
	NO_TEMPLATE: `Hello world!`,
	TEXT_NODES: `0{{ 'A' }}1{{ 'B' }}{{ 'C' }}2{{ 'D' }}3`,

	// Boolean literals
	BOOLEAN_LITERALS: `|{{ true }}|{{ false }}|{{ True }}|{{ False }}|`,

	// Logical operators
	LOGICAL_AND: `{{ true and true }}{{ true and false }}{{ false and true }}{{ false and false }}`,
	LOGICAL_OR: `{{ true or true }}{{ true or false }}{{ false or true }}{{ false or false }}`,
	LOGICAL_NOT: `{{ not true }}{{ not false }}`,
	LOGICAL_NOT_NOT: `{{ not not true }}{{ not not false }}`,
	LOGICAL_AND_OR: `{{ true and true or false }}{{ true and false or true }}{{ false and true or true }}{{ false and false or true }}{{ false and false or false }}`,
	LOGICAL_AND_NOT: `{{ true and not true }}{{ true and not false }}{{ false and not true }}{{ false and not false }}`,
	LOGICAL_OR_NOT: `{{ true or not true }}{{ true or not false }}{{ false or not true }}{{ false or not false }}`,
	LOGICAL_COMBINED: `{{ 1 == 2 and 2 == 2 }}{{ 1 == 2 or 2 == 2}}`,

	// If statements
	IF_ONLY: `{% if 1 == 1 %}{{ 'A' }}{% endif %}{{ 'B' }}`,
	IF_ELSE_ONLY: `{% if 1 == 2 %}{{ 'A' }}{% else %}{{ 'B' }}{% endif %}{{ 'C' }}`,
	IF_ELIF_ELSE: `{% if 1 == 2 %}{{ 'A' }}{{ 'B' }}{{ 'C' }}{% elif 1 == 2 %}{{ 'D' }}{% elif 1 == 3 %}{{ 'E' }}{{ 'F' }}{% else %}{{ 'G' }}{{ 'H' }}{{ 'I' }}{% endif %}{{ 'J' }}`,
	NESTED_STATEMENTS: `{% set a = 0 %}{% set b = 0 %}{% set c = 0 %}{% set d = 0 %}{% if 1 == 1 %}{% set a = 2 %}{% set b = 3 %}{% elif 1 == 2 %}{% set c = 4 %}{% else %}{% set d = 5 %}{% endif %}{{ a }}{{ b }}{{ c }}{{ d }}`,

	// For loops
	FOR_LOOP: `{% for message in messages %}{{ message['content'] }}{% endfor %}`,
	FOR_LOOP_UNPACKING: `|{% for x, y in [ [1, 2], [3, 4] ] %}|{{ x + ' ' + y }}|{% endfor %}|`,
	FOR_LOOP_DEFAULT: `{% for x in [] %}{{ 'A' }}{% else %}{{'B'}}{% endfor %}`,
	FOR_LOOP_SELECT: `{% for x in [1, 2, 3, 4] if x > 2 %}{{ x }}{% endfor %}`,
	FOR_LOOP_SELECT_2: `{% for x in arr | selectattr('value', 'equalto', 'a') %}{{ x['value'] }}{% endfor %}`,
	FOR_LOOP_BREAK: `{% for x in [1, 2, 3, 4] %}{% if x == 3 %}{% break %}{% endif %}{{ x }}{% endfor %}`,
	FOR_LOOP_CONTINUE: `{% for x in [1, 2, 3, 4] %}{% if x == 3 %}{% continue %}{% endif %}{{ x }}{% endfor %}`,
	FOR_LOOP_OBJECTS: `{% for x in obj %}{{ x + ':' + obj[x] + ';' }}{% endfor %}`,

	// Set variables
	VARIABLES: `{% set x = 'Hello' %}{% set y = 'World' %}{{ x + ' ' + y }}`,
	VARIABLES_2: `{% set x = 'Hello'.split('el')[-1] %}{{ x }}`,
	VARIABLES_BLOCK: `{% set x %}Hello!\nMultiline/block set!\n{% endset %}{{ x }}`,
	VARIABLES_UNPACKING: `|{% set x, y = 1, 2 %}{{ x }}{{ y }}|{% set (x, y) = [1, 2] %}{{ x }}{{ y }}|`,

	// Numbers
	NUMBERS: `|{{ 5 }}|{{ -5 }}|{{ add(3, -1) }}|{{ (3 - 1) + (a - 5) - (a + 5)}}|`,

	// Binary expressions
	BINOP_EXPR: `{{ 1 % 2 }}{{ 1 < 2 }}{{ 1 > 2 }}{{ 1 >= 2 }}{{ 2 <= 2 }}{{ 2 == 2 }}{{ 2 != 3 }}{{ 2 + 3 }}`,
	BINOP_EXPR_1: `{{ 1 ~ "+" ~ 2 ~ "=" ~ 3 ~ " is " ~ true }}`,

	// Strings
	STRINGS: `{{ 'Bye' }}{{ bos_token + '[INST] ' }}`,
	STRINGS_1: `|{{ "test" }}|{{ "a" + 'b' + "c" }}|{{ '"' + "'" }}|{{ '\\'' }}|{{ "\\"" }}|`,
	STRINGS_2: `|{{ "" | length }}|{{ "a" | length }}|{{ '' | length }}|{{ 'a' | length }}|`,
	STRINGS_3: `|{{ '{{ "hi" }}' }}|{{ '{% if true %}{% endif %}' }}|`,
	STRINGS_4: `{{ 'a' + 'b' 'c' }}`,

	// Function calls
	FUNCTIONS: `{{ func() }}{{ func(apple) }}{{ func(x, 'test', 2, false) }}`,

	// Object properties
	PROPERTIES: `{{ obj.x + obj.y }}{{ obj['x'] + obj.y }}`,

	// Object methods
	OBJ_METHODS: `{{ obj.x(x, y) }}{{ ' ' + obj.x() + ' ' }}{{ obj.z[x](x, y) }}`,
	STRING_METHODS: `{{ '  A  '.strip() }}{% set x = '  B  ' %}{{ x.strip() }}{% set y = ' aBcD ' %}{{ y.upper() }}{{ y.lower() }}`,
	STRING_METHODS_2: `{{ 'test test'.title() }}`,
	RSTRIP: `{{ "   test it  ".rstrip() }}`,
	LSTRIP: `{{ "   test it  ".lstrip() }}`,
	SPLIT: `|{{ "   test it  ".split() | join("|") }}|`,
	SPLIT_2: `|{{ "   test it  ".split(" ") | join("|") }}|`,
	SPLIT_3: `|{{ "   test it  ".split(" ", 4) | join("|") }}|`,
	SPLIT_4: `|{{ "  1 2  3   ".split() | tojson }}|{{ "babbaccabbb".split("b") | tojson }}|{{ "babbaccabbb".split("b", 2) | tojson }}|`,
	SPLIT_5: `|{{ " 1 2 3 4 5 ".split(none, 0) | join(",") }}|{{ " 1 2 3 4 5 ".split(none, 3) | join(",") }}|{{ " 1 2 3 4 5 ".split(" ", 0) | join(",") }}|{{ " 1 2 3 4 5 ".split(" ", 3) | join(",") }}|{{ " 1 2 3 4 5 ".split(" ", 10) | join(",") }}|`,
	REPLACE: `|{{ "test test".replace("test", "TEST") }}|{{ "test test".replace("test", "TEST", 1) }}|{{ "test test".replace("", "_", 2) }}|{{ "abcabc".replace("a", "x", count=1) }}|`,

	// String indexing and slicing
	STRING_SLICING: `|{{ x[0] }}|{{ x[:] }}|{{ x[:3] }}|{{ x[1:4] }}|{{ x[1:-1] }}|{{ x[1::2] }}|{{ x[5::-1] }}|`,

	// Array indexing and slicing
	ARRAY_SLICING: `|{{ strings[0] }}|{% for s in strings[:] %}{{ s }}{% endfor %}|{% for s in strings[:3] %}{{ s }}{% endfor %}|{% for s in strings[1:4] %}{{ s }}{% endfor %}|{% for s in strings[1:-1] %}{{ s }}{% endfor %}|{% for s in strings[1::2] %}{{ s }}{% endfor %}|{% for s in strings[5::-1] %}{{ s }}{% endfor %}|`,

	// Membership operators
	MEMBERSHIP: `|{{ 0 in arr }}|{{ 1 in arr }}|{{ true in arr }}|{{ false in arr }}|{{ 'a' in arr }}|{{ 'b' in arr }}|`,
	MEMBERSHIP_NEGATION_1: `|{{ not 0 in arr }}|{{ not 1 in arr }}|{{ not true in arr }}|{{ not false in arr }}|{{ not 'a' in arr }}|{{ not 'b' in arr }}|`,
	MEMBERSHIP_NEGATION_2: `|{{ 0 not in arr }}|{{ 1 not in arr }}|{{ true not in arr }}|{{ false not in arr }}|{{ 'a' not in arr }}|{{ 'b' not in arr }}|`,
	MEMBERSHIP_UNDEFINED: `|{{ x is defined }}|{{ y is defined }}|{{ x in y }}|{{ y in x }}|{{ 1 in y }}|{{ 1 in x }}|`,

	// Escaped characters
	ESCAPED_CHARS: `{{ '\\n' }}{{ '\\t' }}{{ '\\'' }}{{ '\\"' }}{{ '\\\\' }}{{ '|\\n|\\t|\\'|\\"|\\\\|' }}`,

	// Substring inclusion
	SUBSTRING_INCLUSION: `|{{ '' in 'abc' }}|{{ 'a' in 'abc' }}|{{ 'd' in 'abc' }}|{{ 'ab' in 'abc' }}|{{ 'ac' in 'abc' }}|{{ 'abc' in 'abc' }}|{{ 'abcd' in 'abc' }}|`,

	// Filter operator
	FILTER_OPERATOR: `{{ arr | length }}{{ 1 + arr | length }}{{ 2 + arr | sort | length }}{{ (arr | sort)[0] }}`,
	FILTER_OPERATOR_2: `|{{ 'abc' | length }}|{{ 'aBcD' | upper }}|{{ 'aBcD' | lower }}|{{ 'test test' | capitalize}}|{{ 'test test' | title }}|{{ ' a b ' | trim }}|{{ '  A  B  ' | trim | lower | length }}|`,
	FILTER_OPERATOR_3: `|{{ -1 | abs }}|{{ 1 | abs }}|`,
	FILTER_OPERATOR_4: `{{ items | selectattr('key') | length }}`,
	FILTER_OPERATOR_5: `{{ messages | selectattr('role', 'equalto', 'system') | length }}`,
	FILTER_OPERATOR_6: `|{{ obj | length }}|{{ (obj | items)[1:] | length }}|`,
	FILTER_OPERATOR_7: `|{{ obj | tojson }}|{{ "test" | tojson }}|{{ 1 | tojson }}|{{ true | tojson }}|{{ null | tojson }}|{{ [1,2,3] | tojson }}|`,
	FILTER_OPERATOR_8: `{{ obj | tojson(indent=2) }}`,
	FILTER_OPERATOR_9: `{{ data | map(attribute='val') | list | tojson }}`,
	FILTER_OPERATOR_10: `|{{ " 1 \n 2 \n 3 \n\n " | indent }}|{{ " 1 \n 2 \n 3 \n\n " | indent(2) }}|{{ " 1 \n 2 \n 3 \n\n " | indent(first=True) }}|{{ " 1 \n 2 \n 3 \n\n " | indent(blank=True) }}|{{ " 1 \n 2 \n 3 \n\n " | indent(4, first=True) }}|`,
	FILTER_OPERATOR_11: `{{ items | rejectattr('key') | length }}`,
	FILTER_OPERATOR_12: `{{ messages | rejectattr('role', 'equalto', 'system') | length }}`,
	FILTER_OPERATOR_13: `{{ tools | string }}`,
	FILTER_OPERATOR_14: `|{{ "1" | int + 2 }}|{{ "invalid" | int }}|{{ "invalid" | int(-1) }}|{{ true | int }}|{{ false | int }}|{{ 1.5 | int }}|{{ "1.5" | float }}|{{ "invalid" | float }}|{{ "invalid" | float("hello") }}|`,
	FILTER_OPERATOR_15: `|{{ "abcabcabc" | replace("a", "b") }}|{{ "abcabcabc" | replace("a", "b", 1) }}|{{ "abcabcabc" | replace("a", "b", count=1) }}|`,
	FILTER_OPERATOR_16: `|{{ undefined | default("hello") }}|{{ false | default("hello") }}|{{ false | default("hello", true) }}|{{ 0 | default("hello", boolean=true) }}|`,
	FILTER_OPERATOR_17: `{{ [1, 2, 1, -1, 2] | unique | list | length }}`,
	FILTER_OPERATOR_DICTSORT_1: `{% for key, value in mydict | dictsort %}{{ key }}:{{ value }},{% endfor %}`,
	FILTER_OPERATOR_DICTSORT_2: `{% for key, value in mydict | dictsort(by='value') %}{{ key }}:{{ value }},{% endfor %}`,
	FILTER_OPERATOR_DICTSORT_3: `{% for key, value in mydict | dictsort(reverse=true) %}{{ key }}:{{ value }},{% endfor %}`,
	FILTER_OPERATOR_DICTSORT_4: `{% for key, value in casedict | dictsort %}{{ key }}:{{ value }},{% endfor %}`,
	FILTER_OPERATOR_DICTSORT_5: `{% for key, value in casedict | dictsort(case_sensitive=true) %}{{ key }}:{{ value }},{% endfor %}`,
	FILTER_OPERATOR_DICTSORT_6: `{% for key, value in numdict | dictsort(by='value', reverse=true) %}{{ key }}:{{ value }},{% endfor %}`,

	// Sort filter tests
	SORT_BASIC_NUMBERS: `{{ [3, 1, 2] | sort }}`,
	SORT_BASIC_STRINGS: `{{ ['banana', 'Apple', 'cherry'] | sort }}`,
	SORT_REVERSE: `{{ [1, 3, 2] | sort(reverse=true) }}`,
	SORT_CASE_SENSITIVE: `{{ ['banana', 'Apple', 'cherry'] | sort(case_sensitive=true) }}`,
	SORT_CASE_INSENSITIVE: `{{ ['banana', 'Apple', 'cherry'] | sort(case_sensitive=false) }}`,
	SORT_ATTRIBUTE_SIMPLE: `{{ users | sort(attribute='name') | map(attribute='name') | list }}`,
	SORT_ATTRIBUTE_REVERSE: `{{ users | sort(attribute='age', reverse=true) | map(attribute='age') | list }}`,
	SORT_ATTRIBUTE_DOT_NOTATION: `{{ items | sort(attribute='details.priority') | map(attribute='details.priority') | list }}`,
	SORT_CHAINED: `{{ users | sort(attribute='name') | sort(reverse=true, attribute='age') | map(attribute='name') | list }}`,
	SORT_STABLE: `{{ items | sort(attribute='category') | map(attribute='name') | list }}`,
	// Sort with positional arguments
	SORT_POSITIONAL_REVERSE: `{{ [1, 3, 2] | sort(true) }}`,
	SORT_POSITIONAL_REVERSE_CASE: `{{ ['banana', 'Apple', 'cherry'] | sort(false, true) }}`,
	SORT_POSITIONAL_ALL: `{{ users | sort(false, false, 'name') | map(attribute='name') | list }}`,
	SORT_POSITIONAL_MIXED: `{{ users | sort(true, attribute='age') | map(attribute='age') | list }}`,
	// Edge cases for sort
	SORT_NULL_VALUES: `{{ [None, None] | sort }}`,
	SORT_UNDEFINED_VALUES: `{{ [a, b, c] | sort }}`,
	SORT_MIXED_BOOL_NUM: `{{ [0, true, false, 1, 0.5] | sort }}`,

	// Filter statements
	FILTER_STATEMENTS: `{% filter upper %}text{% endfilter %}`,

	// Logical operators between non-Booleans
	BOOLEAN_NUMERICAL: `|{{ 1 and 2 }}|{{ 1 and 0 }}|{{ 0 and 1 }}|{{ 0 and 0 }}|{{ 1 or 2 }}|{{ 1 or 0 }}|{{ 0 or 1 }}|{{ 0 or 0 }}|{{ not 1 }}|{{ not 0 }}|`,
	BOOLEAN_STRINGS: `|{{ 'a' and 'b' }}|{{ 'a' and '' }}|{{ '' and 'a' }}|{{ '' and '' }}|{{ 'a' or 'b' }}|{{ 'a' or '' }}|{{ '' or 'a' }}|{{ '' or '' }}|{{ not 'a' }}|{{ not '' }}|`,
	BOOLEAN_MIXED: `|{{ true and 1 }}|{{ true and 0 }}|{{ false and 1 }}|{{ false and 0 }}|{{ true or 1 }}|{{ true or 0 }}|{{ false or 1 }}|{{ false or 0 }}|`,
	BOOLEAN_MIXED_2: `|{{ true and '' }}|{{ true and 'a' }}|{{ false or '' }}|{{ false or 'a' }}|{{ '' and true }}|{{ 'a' and true }}|{{ '' or false }}|{{ 'a' or false }}|`,
	BOOLEAN_MIXED_IF: `{% if '' %}{{ 'A' }}{% endif %}{% if 'a' %}{{ 'B' }}{% endif %}{% if true and '' %}{{ 'C' }}{% endif %}{% if true and 'a' %}{{ 'D' }}{% endif %}`,

	// Tests (is operator)
	IS_OPERATOR: `|{{ unknown_var is defined }}|{{ unknown_var is not defined }}|{{ known_var is defined }}|{{ known_var is not defined }}|`,
	IS_OPERATOR_2: `|{{ true is true }}|{{ true is not true }}|{{ true is false }}|{{ true is not false }}|{{ true is boolean }}|{{ 1 is boolean }}|`,
	IS_OPERATOR_3: `|{{ 1 is odd }}|{{ 2 is odd }}|{{ 1 is even }}|{{ 2 is even }}|{{ 2 is number }}|{{ '2' is number }}|{{ 2 is integer }}|{{ '2' is integer }}|`,
	IS_OPERATOR_4: `|{{ func is callable }}|{{ 2 is callable }}|{{ 1 is iterable }}|{{ 'hello' is iterable }}|`,
	IS_OPERATOR_5: `|{{ 'a' is lower }}|{{ 'A' is lower }}|{{ 'a' is upper }}|{{ 'A' is upper }}|`,
	IS_OPERATOR_6: `|{{ string is mapping }}|{{ number is mapping }}|{{ array is mapping }}|{{ dict is mapping }}|`,

	// Short-circuit evaluation
	SHORT_CIRCUIT: `{{ false and raise_exception('This should not be printed') }}`,
	SHORT_CIRCUIT_1: `{{ true or raise_exception('This should not be printed') }}`,

	// Namespaces
	NAMESPACE: `{% set ns = namespace() %}{% set ns.foo = 'bar' %}{{ ns.foo }}`,
	NAMESPACE_1: `{% set ns = namespace(default=false) %}{{ ns.default }}`,
	NAMESPACE_2: `{% set ns = namespace(default=false, number=1+1) %}|{{ ns.default }}|{{ ns.number }}|`,

	// Object operators
	OBJECT_OPERATORS: `|{{ 'known' in obj }}|{{ 'known' not in obj }}|{{ 'unknown' in obj }}|{{ 'unknown' not in obj }}|`,
	OBJECT_OPERATORS_1: `|{{ obj.get('known') }}|{{ obj.get('unknown') is none }}|{{ obj.get('unknown') is defined }}|`,
	OBJECT_OPERATORS_2: `|{% for x, y in obj.items() %}|{{ x + ' ' + y }}|{% endfor %}|`,

	// Scope
	SCOPE: `{% set ns = namespace(found=false) %}{% for num in nums %}{% if num == 1 %}{{ 'found=' }}{% set ns.found = true %}{% endif %}{% endfor %}{{ ns.found }}`,
	SCOPE_1: `{% set found = false %}{% for num in nums %}{% if num == 1 %}{{ 'found=' }}{% set found = true %}{% endif %}{% endfor %}{{ found }}`,

	// Undefined
	UNDEFINED_VARIABLES: `{{ undefined_variable }}`,
	UNDEFINED_ACCESS: `{{ object.undefined_attribute }}`,

	// Null
	NULL_VARIABLE: `{% if not null_val is defined %}{% set null_val = none %}{% endif %}{% if null_val is not none %}{{ 'fail' }}{% else %}{{ 'pass' }}{% endif %}`,

	// Ternary operator
	TERNARY_OPERATOR: `|{{ 'a' if true else 'b' }}|{{ 'a' if false else 'b' }}|{{ 'a' if 1 + 1 == 2 else 'b' }}|{{ 'a' if 1 + 1 == 3 or 1 * 2 == 3 else 'b' }}|`,
	TERNARY_OPERATOR_1: `{{ (x if true else []) | length }}`,
	TERNARY_SET: `{% set x = 1 if True else 2 %}{{ x }}`,
	TERNARY_CONSECUTIVE: `{% set x = 1 if False else 2 if False else 3 %}{{ x }}`,
	TERNARY_SHORTCUT: `{{ 'foo' if false }}{{ 'bar' if true }}`,

	// Array literals
	ARRAY_LITERALS: `{{ [1, true, 'hello', [1, 2, 3, 4], var] | length }}`,

	// Tuple literals
	TUPLE_LITERALS: `{{ (1, (1, 2)) | length }}`,

	// Object literals
	OBJECT_LITERALS: `{{ { 'key': 'value', key: 'value2', "key3": [1, {'foo': 'bar'} ] }['key'] }}`,
	OBJECT_LITERALS_1: `{{{'key': {'key': 'value'}}['key']['key']}}`,

	// Array operators
	ARRAY_OPERATORS: `{{ ([1, 2, 3] + [4, 5, 6]) | length }}`,

	// Macros
	MACROS: `{% macro hello(name) %}{{ 'Hello ' + name }}{% endmacro %}|{{ hello('Bob') }}|{{ hello('Alice') }}|`,
	MACROS_1: `{% macro hello(name, suffix='.') %}{{ 'Hello ' + name + suffix }}{% endmacro %}|{{ hello('A') }}|{{ hello('B', '!') }}|{{ hello('C', suffix='?') }}|`,
	MACROS_2: `{% macro fn(x, y=2, z=3) %}{{ x + ',' + y + ',' + z }}{% endmacro %}|{{ fn(1) }}|{{ fn(1, 0) }}|{{ fn(1, 0, -1) }}|{{ fn(1, y=0, z=-1) }}|{{ fn(1, z=0) }}|`,
	MACROS_3: `{%- macro dummy(a, b='!') -%}{{ a }} {{ caller() }}{{ b }}{%- endmacro %}{%- call dummy('hello') -%}name{%- endcall -%}`,
	MACROS_4: `{%- macro print_users(users) -%}{%- for user in users -%}{{ caller(user) }}{%- endfor -%}{%- endmacro -%}{% call(user) print_users(users) %}  - {{ user.firstname }} {{ user.lastname }}\n{% endcall %}`,

	// Context-specific keywords
	CONTEXT_KEYWORDS: `{% if if in in %}a{% endif %}{% set if = "a" %}{% set in = "abc" %}{% if if in in %}b{% endif %}`,
	CONTEXT_KEYWORDS_1: `|{{ if }}|{% set if = 2 %}{% if if == 2 %}{{ if }}{% endif %}|`,

	// Unpacking
	UNPACKING: `{% macro mul(a, b, c) %}{{ a * b * c }}{% endmacro %}|{{ mul(1, 2, 3) }}|{{ mul(*[1, 2, 3]) }}|`,

	// Whitespace control
	WHITESPACE_CONTROL_1: `{
{%- for i in [1, 2, 3] -%}
  {{ i }}
{%- endfor -%}
}`,
	WHITESPACE_CONTROL_2: `{%- for i in [1, 2, 3] %}{{ i }}{% endfor -%}`,
	WHITESPACE_CONTROL_3: `  {%- if true -%}  A  {%- endif -%}  `,
	WHITESPACE_CONTROL_4: `A {{- ' B ' -}} C`,
	WHITESPACE_CONTROL_5: `{#- comment -#}X`,
	WHITESPACE_CONTROL_6: `X{#- comment -#}`,
	WHITESPACE_CONTROL_7: `  {%- set x = 1 -%}  {{ x }}`,
	WHITESPACE_CONTROL_8: ` \n A \n {%- set x = 1 %} \n {{ x }} \nB \n{% set y = 2 -%} \n\n C {{- y -}}  D  {#-Comment - goes - here--#} \n E \n `,
};

const TEST_PARSED = {
	// Text nodes
	NO_TEMPLATE: [{ value: "Hello world!", type: "Text" }],
	TEXT_NODES: [
		{ value: "0", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "1", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "B", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "C", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "2", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "D", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "3", type: "Text" },
	],

	// Boolean literals
	BOOLEAN_LITERALS: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "True", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "False", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Logical operators
	LOGICAL_AND: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	LOGICAL_OR: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	LOGICAL_NOT: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	LOGICAL_NOT_NOT: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	LOGICAL_AND_OR: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	LOGICAL_AND_NOT: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	LOGICAL_OR_NOT: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	LOGICAL_COMBINED: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],

	// If statements
	IF_ONLY: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "B", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],
	IF_ELSE_ONLY: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "else", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "B", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "C", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],
	IF_ELIF_ELSE: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "B", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "C", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "elif", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "D", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "elif", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "E", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "F", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "else", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "G", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "H", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "I", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "J", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],
	NESTED_STATEMENTS: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "a", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "b", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "c", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "d", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "a", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "b", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "elif", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "c", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "else", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "d", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "5", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "b", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "c", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "d", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// For loops
	FOR_LOOP: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "message", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "messages", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "message", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "content", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FOR_LOOP_UNPACKING: [
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: ",", type: "Comma" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: " ", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
	],
	FOR_LOOP_DEFAULT: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "else", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "B", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FOR_LOOP_SELECT: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "if", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: ">", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FOR_LOOP_SELECT_2: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "selectattr", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "value", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "equalto", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "a", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "value", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FOR_LOOP_BREAK: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "break", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FOR_LOOP_CONTINUE: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "continue", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FOR_LOOP_OBJECTS: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "obj", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: ":", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "obj", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "x", type: "Identifier" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: ";", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],

	// Set variables
	VARIABLES: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "Hello", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "y", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "World", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: " ", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	VARIABLES_2: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "Hello", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "el", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	VARIABLES_BLOCK: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: `Hello!\nMultiline/block set!\n`, type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endset", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	VARIABLES_UNPACKING: [
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "=", type: "Equals" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Numbers
	NUMBERS: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "5", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "-5", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "add", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "(", type: "OpenParen" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "-", type: "AdditiveBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "Identifier" },
		{ value: "-", type: "AdditiveBinaryOperator" },
		{ value: "5", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "-", type: "AdditiveBinaryOperator" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "5", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Binary expressions
	BINOP_EXPR: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "%", type: "MultiplicativeBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "<", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ">", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ">=", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "<=", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "!=", type: "ComparisonBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],
	BINOP_EXPR_1: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "~", type: "AdditiveBinaryOperator" },
		{ value: "+", type: "StringLiteral" },
		{ value: "~", type: "AdditiveBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "~", type: "AdditiveBinaryOperator" },
		{ value: "=", type: "StringLiteral" },
		{ value: "~", type: "AdditiveBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "~", type: "AdditiveBinaryOperator" },
		{ value: " is ", type: "StringLiteral" },
		{ value: "~", type: "AdditiveBinaryOperator" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Strings
	STRINGS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "Bye", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "bos_token", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "[INST] ", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],
	STRINGS_1: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "test", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "b", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "c", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: '"', type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "'", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "'", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: '"', type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	STRINGS_2: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	STRINGS_3: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: '{{ "hi" }}', type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "{% if true %}{% endif %}", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	STRINGS_4: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "b", type: "StringLiteral" },
		{ value: "c", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Function calls
	FUNCTIONS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "func", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "func", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "apple", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "func", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "test", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "false", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Object properties
	PROPERTIES: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "x", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "x", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Object methods
	OBJ_METHODS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "x", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " ", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "x", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: " ", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "z", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "x", type: "Identifier" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "(", type: "OpenParen" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],

	// String methods
	STRING_METHODS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "  A  ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "strip", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "  B  ", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "strip", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "y", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: " aBcD ", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "y", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "upper", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "y", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "lower", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	STRING_METHODS_2: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "test test", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "title", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],

	RSTRIP: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "   test it  ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "rstrip", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	LSTRIP: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "   test it  ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "lstrip", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	SPLIT: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "   test it  ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "|", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	SPLIT_2: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "   test it  ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: " ", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "|", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	SPLIT_3: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "   test it  ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: " ", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "4", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "|", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	SPLIT_4: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "  1 2  3   ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "babbaccabbb", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "b", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "babbaccabbb", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "b", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	SPLIT_5: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 2 3 4 5 ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "none", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "0", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ",", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 2 3 4 5 ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "none", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ",", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 2 3 4 5 ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: " ", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "0", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ",", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 2 3 4 5 ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: " ", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ",", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 2 3 4 5 ", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "split", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: " ", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "10", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "join", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ",", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	REPLACE: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "test test", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "replace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "test", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "TEST", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "test test", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "replace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "test", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "TEST", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "test test", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "replace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "_", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "abcabc", type: "StringLiteral" },
		{ value: ".", type: "Dot" },
		{ value: "replace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "x", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "count", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// String indexing and slicing
	STRING_SLICING: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: ":", type: "Colon" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: ":", type: "Colon" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: ":", type: "Colon" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "5", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: ":", type: "Colon" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Array indexing and slicing
	ARRAY_SLICING: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "strings", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "s", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "strings", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: ":", type: "Colon" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "s", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "s", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "strings", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: ":", type: "Colon" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "s", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "s", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "strings", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "s", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "s", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "strings", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "s", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "s", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "strings", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: ":", type: "Colon" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "s", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "s", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "strings", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "5", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: ":", type: "Colon" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "s", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
	],

	// Membership operators
	MEMBERSHIP: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "b", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	MEMBERSHIP_NEGATION_1: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "b", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	MEMBERSHIP_NEGATION_2: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "b", type: "StringLiteral" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "arr", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	MEMBERSHIP_UNDEFINED: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "y", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "y", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Escaped characters
	ESCAPED_CHARS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "\n", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "\t", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "'", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: '"', type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "\\", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: `|\n|\t|'|"|\\|`, type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Substring inclusion
	SUBSTRING_INCLUSION: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "d", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "ab", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "ac", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "abcd", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Filter operator
	FILTER_OPERATOR: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "arr", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "arr", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "arr", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "(", type: "OpenParen" },
		{ value: "arr", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_2: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "aBcD", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "upper", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "aBcD", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "lower", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "test test", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "capitalize", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "test test", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "title", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " a b ", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "trim", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "  A  B  ", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "trim", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "lower", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_3: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "abs", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "abs", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_4: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "items", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "selectattr", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "key", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_5: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "messages", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "selectattr", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "role", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "equalto", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "system", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_6: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "(", type: "OpenParen" },
		{ value: "obj", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "items", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_7: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "test", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "null", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_8: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "indent", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_9: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "data", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "val", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "tojson", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_10: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 \n 2 \n 3 \n\n ", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "indent", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 \n 2 \n 3 \n\n ", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "indent", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 \n 2 \n 3 \n\n ", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "indent", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "first", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "True", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 \n 2 \n 3 \n\n ", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "indent", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "blank", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "True", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " 1 \n 2 \n 3 \n\n ", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "indent", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "4", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "first", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "True", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_11: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "items", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "rejectattr", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "key", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_12: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "messages", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "rejectattr", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "role", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "equalto", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "system", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_13: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "tools", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "string", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_14: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "int", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "invalid", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "int", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "invalid", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "int", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "int", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "int", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1.5", type: "NumericLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "int", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1.5", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "float", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "invalid", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "float", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "invalid", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "float", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "hello", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_15: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "abcabcabc", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "replace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "b", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "abcabcabc", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "replace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "b", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "abcabcabc", type: "StringLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "replace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "b", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "count", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_16: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "undefined", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "default", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "hello", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "default", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "hello", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "default", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "hello", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "|", type: "Pipe" },
		{ value: "default", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "hello", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "boolean", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	FILTER_OPERATOR_17: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "unique", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	FILTER_OPERATOR_DICTSORT_1: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "key", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "value", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "mydict", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "dictsort", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "key", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ":", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "value", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ",", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FILTER_OPERATOR_DICTSORT_2: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "key", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "value", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "mydict", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "dictsort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "by", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "value", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "key", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ":", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "value", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ",", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FILTER_OPERATOR_DICTSORT_3: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "key", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "value", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "mydict", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "dictsort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "reverse", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "key", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ":", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "value", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ",", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FILTER_OPERATOR_DICTSORT_4: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "key", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "value", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "casedict", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "dictsort", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "key", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ":", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "value", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ",", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FILTER_OPERATOR_DICTSORT_5: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "key", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "value", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "casedict", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "dictsort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "case_sensitive", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "key", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ":", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "value", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ",", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	FILTER_OPERATOR_DICTSORT_6: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "key", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "value", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "numdict", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "dictsort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "by", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "value", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "reverse", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "key", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ":", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "value", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: ",", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],

	// Sort filter tests
	SORT_BASIC_NUMBERS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_BASIC_STRINGS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "banana", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "Apple", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "cherry", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_REVERSE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "reverse", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_CASE_SENSITIVE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "banana", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "Apple", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "cherry", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "case_sensitive", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_CASE_INSENSITIVE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "banana", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "Apple", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "cherry", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "case_sensitive", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "false", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_ATTRIBUTE_SIMPLE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "users", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "name", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "name", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_ATTRIBUTE_REVERSE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "users", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "age", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "reverse", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "age", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_ATTRIBUTE_DOT_NOTATION: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "items", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "details.priority", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "details.priority", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_CHAINED: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "users", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "name", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "reverse", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "age", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "name", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_STABLE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "items", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "category", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "name", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	// Sort with positional arguments
	SORT_POSITIONAL_REVERSE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_POSITIONAL_REVERSE_CASE: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "banana", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "Apple", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "cherry", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "false", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "true", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_POSITIONAL_ALL: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "users", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "false", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "false", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "name", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "name", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_POSITIONAL_MIXED: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "users", type: "Identifier" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "true", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "age", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "map", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "attribute", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "age", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "list", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	// Edge cases for sort
	SORT_NULL_VALUES: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "None", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "None", type: "Identifier" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_UNDEFINED_VALUES: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "a", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "b", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "c", type: "Identifier" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SORT_MIXED_BOOL_NUM: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "0", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "true", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "false", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "0.5", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "sort", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Filter statements
	FILTER_STATEMENTS: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "filter", type: "Identifier" },
		{ value: "upper", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "text", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfilter", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],

	// Logical operators between non-Booleans
	BOOLEAN_NUMERICAL: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	BOOLEAN_STRINGS: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "b", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "b", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "not", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	BOOLEAN_MIXED: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "0", type: "NumericLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	BOOLEAN_MIXED_2: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "and", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "", type: "StringLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	BOOLEAN_MIXED_IF: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "B", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "C", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "a", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "D", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],

	// Tests (is operator)
	IS_OPERATOR: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "unknown_var", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "unknown_var", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "known_var", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "known_var", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	IS_OPERATOR_2: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "boolean", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "boolean", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	IS_OPERATOR_3: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "odd", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "odd", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "even", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "even", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "number", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "StringLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "number", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "integer", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "StringLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "integer", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	IS_OPERATOR_4: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "func", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "callable", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "callable", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "iterable", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "hello", type: "StringLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "iterable", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	IS_OPERATOR_5: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "lower", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "lower", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "upper", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "A", type: "StringLiteral" },
		{ value: "is", type: "Identifier" },
		{ value: "upper", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	IS_OPERATOR_6: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "string", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "mapping", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "number", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "mapping", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "array", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "mapping", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "dict", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "mapping", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Short-circuit evaluation
	SHORT_CIRCUIT: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "false", type: "Identifier" },
		{ value: "and", type: "Identifier" },
		{ value: "raise_exception", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "This should not be printed", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],
	SHORT_CIRCUIT_1: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "true", type: "Identifier" },
		{ value: "or", type: "Identifier" },
		{ value: "raise_exception", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "This should not be printed", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Namespaces
	NAMESPACE: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "ns", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "namespace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "ns", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "foo", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "bar", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "ns", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "foo", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	NAMESPACE_1: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "ns", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "namespace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "default", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "false", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "ns", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "default", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	NAMESPACE_2: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "ns", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "namespace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "default", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "false", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "number", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "ns", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "default", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "ns", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "number", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Object operators
	OBJECT_OPERATORS: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "known", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "obj", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "known", type: "StringLiteral" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "obj", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "unknown", type: "StringLiteral" },
		{ value: "in", type: "Identifier" },
		{ value: "obj", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "unknown", type: "StringLiteral" },
		{ value: "not", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "obj", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	OBJECT_OPERATORS_1: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "get", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "known", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "get", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "unknown", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "is", type: "Identifier" },
		{ value: "none", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "get", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "unknown", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "is", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	OBJECT_OPERATORS_2: [
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "obj", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "items", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: " ", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
	],

	// Scope
	SCOPE: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "ns", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "namespace", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "found", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "false", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "num", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "nums", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "num", type: "Identifier" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "found=", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "ns", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "found", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "ns", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "found", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	SCOPE_1: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "found", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "false", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "num", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "nums", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "num", type: "Identifier" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "found=", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "found", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "true", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "found", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Undefined
	UNDEFINED_VARIABLES: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "undefined_variable", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	UNDEFINED_ACCESS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "object", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "undefined_attribute", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Null
	NULL_VARIABLE: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "null_val", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "defined", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "null_val", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "none", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "null_val", type: "Identifier" },
		{ value: "is", type: "Identifier" },
		{ value: "not", type: "Identifier" },
		{ value: "none", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "fail", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "else", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "pass", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],

	// Ternary operator
	TERNARY_OPERATOR: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "else", type: "Identifier" },
		{ value: "b", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "else", type: "Identifier" },
		{ value: "b", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "else", type: "Identifier" },
		{ value: "b", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "StringLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "or", type: "Identifier" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "*", type: "MultiplicativeBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "else", type: "Identifier" },
		{ value: "b", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	TERNARY_OPERATOR_1: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "(", type: "OpenParen" },
		{ value: "x", type: "Identifier" },
		{ value: "if", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "else", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	TERNARY_SET: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "True", type: "Identifier" },
		{ value: "else", type: "Identifier" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	TERNARY_CONSECUTIVE: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "False", type: "Identifier" },
		{ value: "else", type: "Identifier" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "False", type: "Identifier" },
		{ value: "else", type: "Identifier" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	TERNARY_SHORTCUT: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "foo", type: "StringLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "false", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "bar", type: "StringLiteral" },
		{ value: "if", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Array literals
	ARRAY_LITERALS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "true", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "hello", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "4", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: ",", type: "Comma" },
		{ value: "var", type: "Identifier" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Tuple literals
	TUPLE_LITERALS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Object literals
	OBJECT_LITERALS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "{", type: "OpenCurlyBracket" },
		{ value: "key", type: "StringLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "value", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "key", type: "Identifier" },
		{ value: ":", type: "Colon" },
		{ value: "value2", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "key3", type: "StringLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "{", type: "OpenCurlyBracket" },
		{ value: "foo", type: "StringLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "bar", type: "StringLiteral" },
		{ value: "}", type: "CloseCurlyBracket" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}", type: "CloseCurlyBracket" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "key", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
	],
	OBJECT_LITERALS_1: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "{", type: "OpenCurlyBracket" },
		{ value: "key", type: "StringLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "{", type: "OpenCurlyBracket" },
		{ value: "key", type: "StringLiteral" },
		{ value: ":", type: "Colon" },
		{ value: "value", type: "StringLiteral" },
		{ value: "}", type: "CloseCurlyBracket" },
		{ value: "}", type: "CloseCurlyBracket" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "key", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "key", type: "StringLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Array operators
	ARRAY_OPERATORS: [
		{ value: "{{", type: "OpenExpression" },
		{ value: "(", type: "OpenParen" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "4", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "5", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "6", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: ")", type: "CloseParen" },
		{ value: "|", type: "Pipe" },
		{ value: "length", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],

	// Macros
	MACROS: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "macro", type: "Identifier" },
		{ value: "hello", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "name", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "Hello ", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "name", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endmacro", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "hello", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "Bob", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "hello", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "Alice", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	MACROS_1: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "macro", type: "Identifier" },
		{ value: "hello", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "name", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "suffix", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: ".", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "Hello ", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "name", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "suffix", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endmacro", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "hello", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "A", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "hello", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "B", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "!", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "hello", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "C", type: "StringLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "suffix", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "?", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	MACROS_2: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "macro", type: "Identifier" },
		{ value: "fn", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "x", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "z", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: ",", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "y", type: "Identifier" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: ",", type: "StringLiteral" },
		{ value: "+", type: "AdditiveBinaryOperator" },
		{ value: "z", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endmacro", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "fn", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "fn", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "0", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "fn", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "0", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "fn", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "y", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "0", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "z", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "-1", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "fn", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "z", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "0", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],
	MACROS_3: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "macro", type: "Identifier" },
		{ value: "dummy", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "b", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "!", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: " ", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "caller", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "b", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endmacro", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "call", type: "Identifier" },
		{ value: "dummy", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "hello", type: "StringLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "name", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endcall", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	MACROS_4: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "macro", type: "Identifier" },
		{ value: "print_users", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "users", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "user", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "users", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "caller", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "user", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endmacro", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "call", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "user", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "print_users", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "users", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "  - ", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "user", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "firstname", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: " ", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "user", type: "Identifier" },
		{ value: ".", type: "Dot" },
		{ value: "lastname", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "\n", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endcall", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],

	// Context-specific keywords
	CONTEXT_KEYWORDS: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "if", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "a", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "if", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "a", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "abc", type: "StringLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "if", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "b", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	CONTEXT_KEYWORDS_1: [
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "if", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "if", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "if", type: "Identifier" },
		{ value: "==", type: "ComparisonBinaryOperator" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "if", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
	],

	// Unpacking
	UNPACKING: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "macro", type: "Identifier" },
		{ value: "mul", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "a", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "b", type: "Identifier" },
		{ value: ",", type: "Comma" },
		{ value: "c", type: "Identifier" },
		{ value: ")", type: "CloseParen" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "a", type: "Identifier" },
		{ value: "*", type: "MultiplicativeBinaryOperator" },
		{ value: "b", type: "Identifier" },
		{ value: "*", type: "MultiplicativeBinaryOperator" },
		{ value: "c", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endmacro", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "mul", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "mul", type: "Identifier" },
		{ value: "(", type: "OpenParen" },
		{ value: "*", type: "MultiplicativeBinaryOperator" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: ")", type: "CloseParen" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "|", type: "Text" },
	],

	// Whitespace control
	WHITESPACE_CONTROL_1: [
		{ value: "{", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "i", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "i", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "}", type: "Text" },
	],
	WHITESPACE_CONTROL_2: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "for", type: "Identifier" },
		{ value: "i", type: "Identifier" },
		{ value: "in", type: "Identifier" },
		{ value: "[", type: "OpenSquareBracket" },
		{ value: "1", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "2", type: "NumericLiteral" },
		{ value: ",", type: "Comma" },
		{ value: "3", type: "NumericLiteral" },
		{ value: "]", type: "CloseSquareBracket" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "i", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endfor", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	WHITESPACE_CONTROL_3: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "if", type: "Identifier" },
		{ value: "true", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "A", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "endif", type: "Identifier" },
		{ value: "%}", type: "CloseStatement" },
	],
	WHITESPACE_CONTROL_4: [
		{ value: "A", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: " B ", type: "StringLiteral" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "C", type: "Text" },
	],
	WHITESPACE_CONTROL_5: [
		{ value: " comment ", type: "Comment" },
		{ value: "X", type: "Text" },
	],
	WHITESPACE_CONTROL_6: [
		{ value: "X", type: "Text" },
		{ value: " comment ", type: "Comment" },
	],
	WHITESPACE_CONTROL_7: [
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
	],
	WHITESPACE_CONTROL_8: [
		{ value: " \n A", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "x", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "1", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: " \n ", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "x", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: " \nB \n", type: "Text" },
		{ value: "{%", type: "OpenStatement" },
		{ value: "set", type: "Identifier" },
		{ value: "y", type: "Identifier" },
		{ value: "=", type: "Equals" },
		{ value: "2", type: "NumericLiteral" },
		{ value: "%}", type: "CloseStatement" },
		{ value: "C", type: "Text" },
		{ value: "{{", type: "OpenExpression" },
		{ value: "y", type: "Identifier" },
		{ value: "}}", type: "CloseExpression" },
		{ value: "D", type: "Text" },
		{ value: "Comment - goes - here-", type: "Comment" },
		{ value: "E \n ", type: "Text" },
	],
};

const TEST_CONTEXT = {
	// Text nodes
	NO_TEMPLATE: {},
	TEXT_NODES: {},

	// Boolean literals
	BOOLEAN_LITERALS: {},

	// Logical operators
	LOGICAL_AND: {},
	LOGICAL_OR: {},
	LOGICAL_NOT: {},
	LOGICAL_NOT_NOT: {},
	LOGICAL_AND_OR: {},
	LOGICAL_AND_NOT: {},
	LOGICAL_OR_NOT: {},
	LOGICAL_COMBINED: {},

	// If statements
	IF_ONLY: {},
	IF_ELSE_ONLY: {},
	IF_ELIF_ELSE: {},
	NESTED_STATEMENTS: {},

	// For loops
	FOR_LOOP: {
		messages: [
			{ role: "user", content: "A" },
			{ role: "assistant", content: "B" },
			{ role: "user", content: "C" },
		],
	},
	FOR_LOOP_UNPACKING: {},
	FOR_LOOP_DEFAULT: {},
	FOR_LOOP_SELECT: {},
	FOR_LOOP_SELECT_2: {
		arr: [{ value: "a" }, { value: "b" }, { value: "c" }, { value: "a" }],
	},
	FOR_LOOP_BREAK: {},
	FOR_LOOP_CONTINUE: {},
	FOR_LOOP_OBJECTS: {
		obj: {
			a: 1,
			b: 2,
			c: 3,
		},
	},

	// Set variables
	VARIABLES: {},
	VARIABLES_2: {},
	VARIABLES_BLOCK: {},
	VARIABLES_UNPACKING: {},

	// Numbers
	NUMBERS: {
		a: 0,
		add: (x, y) => x + y,
	},

	// Binary expressions
	BINOP_EXPR: {},
	BINOP_EXPR_1: {},

	// Strings
	STRINGS: {
		bos_token: "<s>",
	},
	STRINGS_1: {},
	STRINGS_2: {},
	STRINGS_3: {},
	STRINGS_4: {},

	// Function calls
	FUNCTIONS: {
		x: 10,
		apple: "apple",
		func: (...args) => args.length,
	},

	// Object properties
	PROPERTIES: {
		obj: { x: 10, y: 20 },
	},

	// Object methods
	OBJ_METHODS: {
		x: "A",
		y: "B",
		obj: {
			x: (...args) => args.join(""),
			z: {
				A: (...args) => args.join("_"),
			},
		},
	},

	// String methods
	STRING_METHODS: {},
	STRING_METHODS_2: {},
	RSTRIP: {},
	LSTRIP: {},
	SPLIT: {},
	SPLIT_2: {},
	SPLIT_3: {},
	SPLIT_4: {},
	SPLIT_5: {},
	REPLACE: {},

	// String indexing and slicing
	STRING_SLICING: {
		x: "0123456789",
	},

	// Array indexing and slicing
	ARRAY_SLICING: {
		strings: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
	},

	// Membership operators
	MEMBERSHIP: {
		arr: [0, true, "a"],
	},
	MEMBERSHIP_NEGATION_1: {
		arr: [0, true, "a"],
	},
	MEMBERSHIP_NEGATION_2: {
		arr: [0, true, "a"],
	},
	MEMBERSHIP_UNDEFINED: {},

	// Escaped characters
	ESCAPED_CHARS: {},

	// Substring inclusion
	SUBSTRING_INCLUSION: {},

	// Filter operator
	FILTER_OPERATOR: {
		arr: [3, 2, 1],
	},
	FILTER_OPERATOR_2: {},
	FILTER_OPERATOR_3: {},
	FILTER_OPERATOR_4: {
		items: [{ key: "a" }, { key: 0 }, { key: 1 }, {}, { key: false }],
	},
	FILTER_OPERATOR_5: {
		messages: [{ role: "system" }, { role: "user" }, { role: "assistant" }],
	},
	FILTER_OPERATOR_6: {
		obj: { a: 1, b: 2, c: 3 },
	},
	FILTER_OPERATOR_7: {
		obj: {
			// Test basic types
			string: "world",
			number: 5,
			boolean: true,
			null: null,
			// undefined: undefined,

			// Test arrays
			array: [1, 2, 3],

			// Test objects
			object: { key: "value" },

			// Test formatting
			special: `"',:[]{}#&*;=?/\\\`~@|!^%()-_+<>`,

			// Test unicode (https://github.com/huggingface/transformers/pull/31041)
			unicode: { "안녕?": "🤗" },
		},
	},
	FILTER_OPERATOR_8: {
		obj: {
			a: [1, 2, 3],
			b: 1,
			c: {
				d: 2,
				e: {
					f: 3,
					g: {
						h: 4,
						i: [1, 2, 3],
					},
				},
			},
		},
	},
	FILTER_OPERATOR_9: {
		data: [{ val: 1 }, { val: 2 }, { val: 3 }],
	},
	FILTER_OPERATOR_10: {},
	FILTER_OPERATOR_11: {
		items: [{ key: "a" }, { key: 0 }, { key: 1 }, {}, { key: false }],
	},
	FILTER_OPERATOR_12: {
		messages: [{ role: "system" }, { role: "user" }, { role: "assistant" }],
	},
	FILTER_OPERATOR_13: {
		tools: [{ name: "some_tool", arguments: { some_name: "string" } }],
	},
	FILTER_OPERATOR_14: {},
	FILTER_OPERATOR_15: {},
	FILTER_OPERATOR_16: {},
	FILTER_OPERATOR_17: {},
	FILTER_OPERATOR_DICTSORT_1: {
		mydict: { c: 3, a: 1, b: 2 },
	},
	FILTER_OPERATOR_DICTSORT_2: {
		mydict: { c: 3, a: 1, b: 2 },
	},
	FILTER_OPERATOR_DICTSORT_3: {
		mydict: { c: 3, a: 1, b: 2 },
	},
	FILTER_OPERATOR_DICTSORT_4: {
		casedict: { B: 2, a: 1, C: 3 },
	},
	FILTER_OPERATOR_DICTSORT_5: {
		casedict: { B: 2, a: 1, C: 3 },
	},
	FILTER_OPERATOR_DICTSORT_6: {
		numdict: { apple: 5, banana: 2, cherry: 8 },
	},

	// Sort filter tests
	SORT_BASIC_NUMBERS: {},
	SORT_BASIC_STRINGS: {},
	SORT_REVERSE: {},
	SORT_CASE_SENSITIVE: {},
	SORT_CASE_INSENSITIVE: {},
	SORT_ATTRIBUTE_SIMPLE: {
		users: [
			{ name: "Charlie", age: 30 },
			{ name: "Alice", age: 25 },
			{ name: "Bob", age: 35 },
		],
	},
	SORT_ATTRIBUTE_REVERSE: {
		users: [
			{ name: "Charlie", age: 30 },
			{ name: "Alice", age: 25 },
			{ name: "Bob", age: 35 },
		],
	},
	SORT_ATTRIBUTE_DOT_NOTATION: {
		items: [
			{ name: "item1", details: { priority: 3 } },
			{ name: "item2", details: { priority: 1 } },
			{ name: "item3", details: { priority: 2 } },
		],
	},
	SORT_CHAINED: {
		users: [
			{ name: "Charlie", age: 30 },
			{ name: "Alice", age: 30 },
			{ name: "Bob", age: 35 },
			{ name: "David", age: 25 },
		],
	},
	SORT_STABLE: {
		items: [
			{ name: "apple", category: "fruit" },
			{ name: "carrot", category: "vegetable" },
			{ name: "banana", category: "fruit" },
			{ name: "broccoli", category: "vegetable" },
		],
	},
	// Sort with positional arguments
	SORT_POSITIONAL_REVERSE: {},
	SORT_POSITIONAL_REVERSE_CASE: {},
	SORT_POSITIONAL_ALL: {
		users: [
			{ name: "Charlie", age: 30 },
			{ name: "Alice", age: 25 },
			{ name: "Bob", age: 35 },
		],
	},
	SORT_POSITIONAL_MIXED: {
		users: [
			{ name: "Charlie", age: 30 },
			{ name: "Alice", age: 25 },
			{ name: "Bob", age: 35 },
		],
	},
	// Edge cases for sort
	SORT_NULL_VALUES: {},
	SORT_UNDEFINED_VALUES: {},
	SORT_MIXED_BOOL_NUM: {},

	// Filter statements
	FILTER_STATEMENTS: {},

	// Logical operators between non-Booleans
	BOOLEAN_NUMERICAL: {},
	BOOLEAN_STRINGS: {},
	BOOLEAN_MIXED: {},
	BOOLEAN_MIXED_2: {},
	BOOLEAN_MIXED_IF: {},

	// Tests (is operator)
	IS_OPERATOR: {
		known_var: "Hello World",
	},
	IS_OPERATOR_2: {},
	IS_OPERATOR_3: {},
	IS_OPERATOR_4: {
		func: () => {},
	},
	IS_OPERATOR_5: {},
	IS_OPERATOR_6: {
		string: "hello",
		number: 1,
		array: [1, 2, 3],
		dict: { a: 1 },
	},

	// Short-circuit evaluation
	SHORT_CIRCUIT: {},
	SHORT_CIRCUIT_1: {},

	// Namespaces
	NAMESPACE: {},
	NAMESPACE_1: {},
	NAMESPACE_2: {},

	// Object operators
	OBJECT_OPERATORS: {
		obj: {
			known: true,
		},
	},
	OBJECT_OPERATORS_1: {
		obj: {
			known: true,
		},
	},
	OBJECT_OPERATORS_2: {
		obj: { a: 1, b: 2, c: 3 },
	},

	// Scope
	SCOPE: { nums: [1, 2, 3] },
	SCOPE_1: { nums: [1, 2, 3] },

	// Undefined
	UNDEFINED_VARIABLES: {},
	UNDEFINED_ACCESS: { object: {} },

	// Null
	NULL_VARIABLE: { a: null },

	// Ternary operator
	TERNARY_OPERATOR: {},
	TERNARY_OPERATOR_1: {
		x: [{}, {}, {}],
	},
	TERNARY_SET: {},
	TERNARY_CONSECUTIVE: {},
	TERNARY_SHORTCUT: {},

	// Array literals
	ARRAY_LITERALS: { var: true },

	// Tuple literals
	TUPLE_LITERALS: {},

	// Object literals
	OBJECT_LITERALS: {
		key: "key2",
	},
	OBJECT_LITERALS_1: {},

	// Array operators
	ARRAY_OPERATORS: {},

	// Macros
	MACROS: {},
	MACROS_1: {},
	MACROS_2: {},
	MACROS_3: {},
	MACROS_4: {
		users: [
			{ firstname: "John", lastname: "Doe" },
			{ firstname: "Jane", lastname: "Smith" },
		],
	},

	// Context-specific keywords
	CONTEXT_KEYWORDS: {},
	CONTEXT_KEYWORDS_1: {},

	// Unpacking
	UNPACKING: {},

	// Whitespace control
	WHITESPACE_CONTROL_1: {},
	WHITESPACE_CONTROL_2: {},
	WHITESPACE_CONTROL_3: {},
	WHITESPACE_CONTROL_4: {},
	WHITESPACE_CONTROL_5: {},
	WHITESPACE_CONTROL_6: {},
	WHITESPACE_CONTROL_7: {},
	WHITESPACE_CONTROL_8: {},
};

const EXPECTED_OUTPUTS = {
	// Text nodes
	NO_TEMPLATE: `Hello world!`,
	TEXT_NODES: `0A1BC2D3`,

	// Boolean literals
	BOOLEAN_LITERALS: `|true|false|true|false|`,

	// Logical operators
	LOGICAL_AND: `truefalsefalsefalse`,
	LOGICAL_OR: `truetruetruefalse`,
	LOGICAL_NOT: `falsetrue`,
	LOGICAL_NOT_NOT: `truefalse`,
	LOGICAL_AND_OR: `truetruetruetruefalse`,
	LOGICAL_AND_NOT: `falsetruefalsefalse`,
	LOGICAL_OR_NOT: `truetruefalsetrue`,
	LOGICAL_COMBINED: `falsetrue`,

	// If statements
	IF_ONLY: "AB",
	IF_ELSE_ONLY: "BC",
	IF_ELIF_ELSE: "GHIJ",
	NESTED_STATEMENTS: "2300",

	// For loops
	FOR_LOOP: "ABC",
	FOR_LOOP_UNPACKING: "||1 2||3 4||",
	FOR_LOOP_DEFAULT: "B",
	FOR_LOOP_SELECT: "34",
	FOR_LOOP_SELECT_2: "aa",
	FOR_LOOP_BREAK: "12",
	FOR_LOOP_CONTINUE: "124",
	FOR_LOOP_OBJECTS: "a:1;b:2;c:3;",

	// Set variables
	VARIABLES: "Hello World",
	VARIABLES_2: "lo",
	VARIABLES_BLOCK: "Hello!\nMultiline/block set!\n",
	VARIABLES_UNPACKING: "|12|12|",

	// Numbers
	NUMBERS: "|5|-5|2|-8|",

	// Binary expressions
	BINOP_EXPR: "1truefalsefalsetruetruetrue5",
	BINOP_EXPR_1: "1+2=3 is true",

	// Strings
	STRINGS: "Bye<s>[INST] ",
	STRINGS_1: `|test|abc|"'|'|"|`,
	STRINGS_2: `|0|1|0|1|`,
	STRINGS_3: `|{{ "hi" }}|{% if true %}{% endif %}|`,
	STRINGS_4: `abc`,

	// Function calls
	FUNCTIONS: "014",

	// Object properties
	PROPERTIES: "3030",

	// Object methods
	OBJ_METHODS: "AB  A_B",
	STRING_METHODS: "AB ABCD  abcd ",
	STRING_METHODS_2: "Test Test",
	RSTRIP: `   test it`,
	LSTRIP: `test it  `,
	SPLIT: `|test|it|`,
	SPLIT_2: `||||test|it|||`,
	SPLIT_3: `||||test|it  |`,
	SPLIT_4: `|["1", "2", "3"]|["", "a", "", "acca", "", "", ""]|["", "a", "baccabbb"]|`,
	SPLIT_5: `|1 2 3 4 5 |1,2,3,4 5 | 1 2 3 4 5 |,1,2,3 4 5 |,1,2,3,4,5,|`,
	REPLACE: `|TEST TEST|TEST test|_t_est test|xbcabc|`,

	// String indexing and slicing
	STRING_SLICING: "|0|0123456789|012|123|12345678|13579|543210|",

	// Array indexing and slicing
	ARRAY_SLICING: "|0|0123456789|012|123|12345678|13579|543210|",

	// Membership operators
	MEMBERSHIP: "|true|false|true|false|true|false|",
	MEMBERSHIP_NEGATION_1: "|false|true|false|true|false|true|",
	MEMBERSHIP_NEGATION_2: "|false|true|false|true|false|true|",
	MEMBERSHIP_UNDEFINED: "|false|false|false|false|false|false|",

	// Escaped characters
	ESCAPED_CHARS: `\n\t'"\\|\n|\t|'|"|\\|`,

	// Substring inclusion
	SUBSTRING_INCLUSION: `|true|true|false|true|false|true|false|`,

	// Filter operator
	FILTER_OPERATOR: `3451`,
	FILTER_OPERATOR_2: `|3|ABCD|abcd|Test test|Test Test|a b|4|`,
	FILTER_OPERATOR_3: `|1|1|`,
	FILTER_OPERATOR_4: `2`,
	FILTER_OPERATOR_5: `1`,
	FILTER_OPERATOR_6: `|3|2|`,
	FILTER_OPERATOR_7: `|{"string": "world", "number": 5, "boolean": true, "null": null, "array": [1, 2, 3], "object": {"key": "value"}, "special": "\\"',:[]{}#&*;=?/\\\\\`~@|!^%()-_+<>", "unicode": {"안녕?": "🤗"}}|"test"|1|true|null|[1, 2, 3]|`,
	FILTER_OPERATOR_8: `{\n  "a": [\n    1,\n    2,\n    3\n  ],\n  "b": 1,\n  "c": {\n    "d": 2,\n    "e": {\n      "f": 3,\n      "g": {\n        "h": 4,\n        "i": [\n          1,\n          2,\n          3\n        ]\n      }\n    }\n  }\n}`,
	FILTER_OPERATOR_9: `[1, 2, 3]`,
	FILTER_OPERATOR_10: `| 1 \n     2 \n     3 \n\n     | 1 \n   2 \n   3 \n\n   |     1 \n     2 \n     3 \n\n     | 1 \n     2 \n     3 \n    \n     |     1 \n     2 \n     3 \n\n     |`,
	FILTER_OPERATOR_11: `3`,
	FILTER_OPERATOR_12: `2`,
	FILTER_OPERATOR_13: `[{"name": "some_tool", "arguments": {"some_name": "string"}}]`,
	FILTER_OPERATOR_14: `|3|0|-1|1|0|1|1.5|0.0|hello|`,
	FILTER_OPERATOR_15: `|bbcbbcbbc|bbcabcabc|bbcabcabc|`,
	FILTER_OPERATOR_16: `|hello|false|hello|hello|`,
	FILTER_OPERATOR_17: `3`,
	FILTER_OPERATOR_DICTSORT_1: `a:1,b:2,c:3,`,
	FILTER_OPERATOR_DICTSORT_2: `a:1,b:2,c:3,`,
	FILTER_OPERATOR_DICTSORT_3: `c:3,b:2,a:1,`,
	FILTER_OPERATOR_DICTSORT_4: `a:1,B:2,C:3,`,
	FILTER_OPERATOR_DICTSORT_5: `B:2,C:3,a:1,`,
	FILTER_OPERATOR_DICTSORT_6: `cherry:8,apple:5,banana:2,`,

	// Sort filter tests
	SORT_BASIC_NUMBERS: `[1, 2, 3]`,
	SORT_BASIC_STRINGS: `["Apple", "banana", "cherry"]`,
	SORT_REVERSE: `[3, 2, 1]`,
	SORT_CASE_SENSITIVE: `["Apple", "banana", "cherry"]`,
	SORT_CASE_INSENSITIVE: `["Apple", "banana", "cherry"]`,
	SORT_ATTRIBUTE_SIMPLE: `["Alice", "Bob", "Charlie"]`,
	SORT_ATTRIBUTE_REVERSE: `[35, 30, 25]`,
	SORT_ATTRIBUTE_DOT_NOTATION: `[1, 2, 3]`,
	SORT_CHAINED: `["Bob", "Alice", "Charlie", "David"]`,
	SORT_STABLE: `["apple", "banana", "carrot", "broccoli"]`,
	// Sort with positional arguments
	SORT_POSITIONAL_REVERSE: `[3, 2, 1]`,
	SORT_POSITIONAL_REVERSE_CASE: `["Apple", "banana", "cherry"]`,
	SORT_POSITIONAL_ALL: `["Alice", "Bob", "Charlie"]`,
	SORT_POSITIONAL_MIXED: `[35, 30, 25]`,
	// Edge cases for sort
	SORT_NULL_VALUES: `[null, null]`,
	SORT_UNDEFINED_VALUES: `[undefined, undefined, undefined]`,
	SORT_MIXED_BOOL_NUM: `[0, false, 0.5, true, 1]`,

	// Filter statements
	FILTER_STATEMENTS: `TEXT`,

	// Logical operators between non-Booleans
	BOOLEAN_NUMERICAL: `|2|0|0|0|1|1|1|0|false|true|`,
	BOOLEAN_STRINGS: `|b||||a|a|a||false|true|`,
	BOOLEAN_MIXED: `|1|0|false|false|true|true|1|0|`,
	BOOLEAN_MIXED_2: `||a||a||true|false|a|`,
	BOOLEAN_MIXED_IF: `BD`,

	// Tests (is operator)
	IS_OPERATOR: `|false|true|true|false|`,
	IS_OPERATOR_2: `|true|false|false|true|true|false|`,
	IS_OPERATOR_3: `|true|false|false|true|true|false|true|false|`,
	IS_OPERATOR_4: `|true|false|false|true|`,
	IS_OPERATOR_5: `|true|false|false|true|`,
	IS_OPERATOR_6: `|false|false|false|true|`,

	// Short-circuit evaluation
	SHORT_CIRCUIT: `false`,
	SHORT_CIRCUIT_1: `true`,

	// Namespaces
	NAMESPACE: `bar`,
	NAMESPACE_1: `false`,
	NAMESPACE_2: `|false|2|`,

	// Object operators
	OBJECT_OPERATORS: `|true|false|false|true|`,
	OBJECT_OPERATORS_1: `|true|true|true|`,
	OBJECT_OPERATORS_2: `||a 1||b 2||c 3||`,

	// Scope
	SCOPE: `found=true`,
	SCOPE_1: `found=false`,

	// Undefined
	UNDEFINED_VARIABLES: ``,
	UNDEFINED_ACCESS: ``,

	// Null
	NULL_VARIABLE: `pass`,

	// Ternary operator
	TERNARY_OPERATOR: `|a|b|a|b|`,
	TERNARY_OPERATOR_1: `3`,
	TERNARY_SET: `1`,
	TERNARY_CONSECUTIVE: `3`,
	TERNARY_SHORTCUT: `bar`,

	// Array literals
	ARRAY_LITERALS: `5`,

	// Tuple literals
	TUPLE_LITERALS: `2`,

	// Object literals
	OBJECT_LITERALS: `value`,
	OBJECT_LITERALS_1: `value`,

	// Array operators
	ARRAY_OPERATORS: `6`,

	// Macros
	MACROS: `|Hello Bob|Hello Alice|`,
	MACROS_1: `|Hello A.|Hello B!|Hello C?|`,
	MACROS_2: `|1,2,3|1,0,3|1,0,-1|1,0,-1|1,2,0|`,
	MACROS_3: `hello name!`,
	MACROS_4: "  - John Doe\n  - Jane Smith\n",

	// Context-specific keywords
	CONTEXT_KEYWORDS: `b`,
	CONTEXT_KEYWORDS_1: `||2|`,

	// Unpacking
	UNPACKING: `|6|6|`,

	// Whitespace control
	WHITESPACE_CONTROL_1: `{123}`,
	WHITESPACE_CONTROL_2: `123`,
	WHITESPACE_CONTROL_3: `A`,
	WHITESPACE_CONTROL_4: `A B C`,
	WHITESPACE_CONTROL_5: `X`,
	WHITESPACE_CONTROL_6: `X`,
	WHITESPACE_CONTROL_7: `1`,
	WHITESPACE_CONTROL_8: ` \n A \n 1 \nB \nC2DE \n `,
};

describe("Templates", () => {
	describe("Lexing", () => {
		describe("should tokenize an input string", () => {
			for (const [name, text] of Object.entries(TEST_STRINGS)) {
				const tokens = tokenize(text);

				if (!TEST_PARSED[name]) {
					throw new Error(`Test case "${name}" not found`);
				}

				it(name, () => {
					if (tokens.length !== TEST_PARSED[name].length) {
						console.error(tokens);
					}
					expect(tokens).toMatchObject(TEST_PARSED[name]);
				});
			}
		});

		// TODO add failure cases
	});

	describe("Parsing and interpretation", () => {
		describe("should interpret an AST", () => {
			for (const [name, text] of Object.entries(TEST_PARSED)) {
				const ast = parse(text);
				if (TEST_CONTEXT[name] === undefined || EXPECTED_OUTPUTS[name] === undefined) {
					console.warn(`Skipping test case "${name}" due to missing context or expected output`);
					continue;
				}
				it(name, () => {
					const env = new Environment();
					setupGlobals(env);

					// Add user-defined variables
					for (const [key, value] of Object.entries(TEST_CONTEXT[name])) {
						env.set(key, value);
					}

					const interpreter = new Interpreter(env);
					const result = interpreter.run(ast);
					expect(result.value).toEqual(EXPECTED_OUTPUTS[name]);
				});
			}
		});
	});

	describe("Formatting", () => {
		describe("formatting shouldn't change output", () => {
			for (const [name, text] of Object.entries(TEST_STRINGS)) {
				it(`formatting ${name}`, () => {
					const context = TEST_CONTEXT[name];

					const template = new Template(text);
					const unformattedTemplateOutput = template.render(context);

					const formatted = template.format();
					const formattedTemplate = new Template(formatted);
					const formattedTemplateOutput = formattedTemplate.render(context);

					expect(formattedTemplateOutput).toEqual(unformattedTemplateOutput);
				});
			}
		});
	});
});

describe("Error checking", () => {
	describe("Lexing errors", () => {
		it("Missing closing curly brace", () => {
			const text = "{{ variable";
			expect(() => tokenize(text)).toThrowError();
		});
		it("Unclosed string literal", () => {
			const text = `{{ 'unclosed string }}`;
			expect(() => tokenize(text)).toThrowError();
		});

		it("Unexpected character", () => {
			const text = "{{ invalid ! invalid }}";
			expect(() => tokenize(text)).toThrowError();
		});

		it("Invalid quote character", () => {
			const text = "{{ \u2018text\u2019 }}";
			expect(() => tokenize(text)).toThrowError();
		});
	});

	describe("Parsing errors", () => {
		it("Unclosed statement", () => {
			const text = "{{ variable }}{{";
			const tokens = tokenize(text);
			expect(() => parse(tokens)).toThrowError();
		});

		it("Unclosed expression", () => {
			const text = "{% if condition %}\n    Content";
			const tokens = tokenize(text);
			expect(() => parse(tokens)).toThrowError();
		});

		it("Unmatched control structure", () => {
			const text = "{% if condition %}\n    Content\n{% endif %}\n{% endfor %}";
			const tokens = tokenize(text);
			expect(() => parse(tokens)).toThrowError();
		});

		it("Missing variable in for loop", () => {
			const text = "{% for %}\n    Content\n{% endfor %}";
			const tokens = tokenize(text);
			expect(() => parse(tokens)).toThrowError();
		});

		it("Unclosed parentheses in expression", () => {
			const text = "{{ (variable + 1 }}";
			const tokens = tokenize(text);
			expect(() => parse(tokens)).toThrowError();
		});

		it("Invalid variable name", () => {
			const text = "{{ 1variable }}";
			const tokens = tokenize(text);
			expect(() => parse(tokens)).toThrowError();
		});

		it("Invalid control structure usage", () => {
			const text = "{% if %}Content{% endif %}";
			const tokens = tokenize(text);
			expect(() => parse(tokens)).toThrowError();
		});
	});

	describe("Runtime errors", () => {
		it("Undefined function call", () => {
			const env = new Environment();
			const interpreter = new Interpreter(env);
			const tokens = tokenize("{{ undefined_function() }}");
			const ast = parse(tokens);
			expect(() => interpreter.run(ast)).toThrowError();
		});

		it("Incorrect function call", () => {
			const env = new Environment();
			env.set("true", true);

			const interpreter = new Interpreter(env);
			const tokens = tokenize("{{ true() }}");
			const ast = parse(tokens);
			expect(() => interpreter.run(ast)).toThrowError();
		});

		it("Looping over non-iterable", () => {
			const env = new Environment();
			const interpreter = new Interpreter(env);
			env.set("non_iterable", 10);

			const tokens = tokenize("{% for item in non_iterable %}{{ item }}{% endfor %}");
			const ast = parse(tokens);
			expect(() => interpreter.run(ast)).toThrowError();
		});

		it("Invalid variable assignment", () => {
			const env = new Environment();
			const interpreter = new Interpreter(env);

			const tokens = tokenize("{% set 42 = variable %}");
			const ast = parse(tokens);
			expect(() => interpreter.run(ast)).toThrowError();
		});
	});
});
